<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>订单管理</title>
	<%--静态包含很多页面都需要的公共部分：base标签，css样式，jquery--%>
	<%@include file="/pages/common/head.jsp"%>
</head>
<body>

	<div id="header">
		<img class="logo_img" alt="" src="static/img/logo3.jpg" >
		<span class="wel_word">订单管理系统</span>
		<%--静态包含，登录成功后的菜单，这样只需维护一份--%>
		<%@include file="/pages/common/login_success_menu.jsp"%>

		<script type="text/javascript">
			$(function () {
				//给发货的a标签绑定单击事件,用于确认提示
				$("a.sendOrder").click(function () {
					return confirm("你确定要发出吗?")
				});
			});

		</script>
	</div>
	
	<div id="main">
		<table>
			<tr>
				<td>日期</td>
				<td>金额</td>
				<td>详情</td>
				<td>发货</td>

			</tr>

			<c:forEach items="${requestScope.orders}" var="order">
				<c:if test="${order.status==0}">
					<tr>
						<td>${order.createTime}</td>
						<td>${order.price}</td>
						<td><a href="orderServlet?action=showOrderDetail&orderId=${order.orderId}&userId=${order.userId}">查看详情</a></td>
						<td><a class="sendOrder" href="orderServlet?action=sendOrder&orderId=${order.orderId}">点击发货</a></td>
					</tr>
				</c:if>

				<c:if test="${order.status==1}">
					<tr>
						<td>${order.createTime}</td>
						<td>${order.price}</td>
						<td><a href="orderServlet?action=showOrderDetail&orderId=${order.orderId}&userId=${order.userId}">查看详情</a></td>
						<td>等待收货</td>
					</tr>
				</c:if>

				<c:if test="${order.status==2}">
					<tr>
						<td>${order.createTime}</td>
						<td>${order.price}</td>
						<td><a href="orderServlet?action=showOrderDetail&orderId=${order.orderId}&userId=${order.userId}">查看详情</a></td>
						<td>已收货</td>
					</tr>
				</c:if>
			</c:forEach>

		</table>
	</div>

	<%--静态包含公共页脚--%>
	<%@include file="/pages/common/footer.jsp"%>
</body>
</html>